home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 3 / Your Choice Software Collection 3.iso / os2 / etelr21 / rebaccts.vrm < prev    next >
Text File  |  1994-09-16  |  4KB  |  113 lines

  1. /***********************************************/
  2. /* VX-Rexx Macro to build the lstaccts.etm     */
  3. /* E-Teller macro.                             */
  4. /* Please do not modify                        */
  5. /***********************************************/
  6. /* Custom mainline for macro */
  7.  
  8.     call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
  9.     call VRLoadFuncs
  10.  
  11.     _VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
  12.     if( _VREVersion < 2.02 )then do
  13.         call VRMessage "", "This program requires VX-REXX version 2.0b to run.", "Error!"
  14.         return 32000
  15.     end
  16.  
  17.     signal on SYNTAX name _VRESyntax
  18.     signal _VREMain
  19.  
  20. _VRESyntax:
  21.     parse source . . _VRESourceSpec
  22.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL, "Error!"
  23.     exit 32000
  24.  
  25. _VREMain:
  26. /*:VRX         Main
  27. */
  28. Main:
  29. parse arg INI .
  30. if INI = '' then do
  31.    call VRMessage 'Screen', 'Command line error.  ', 'Error'
  32.    exit
  33. end
  34. MAC = 'macros\lstaccts.etm'
  35. AcctDir = VRGetINI( 'Main', 'AcctDir', INI )
  36. if AcctDir = '' then AcctDir = VRGet( 'Application', 'WorkingDirectory' )
  37. s = VRDir( AcctDir||'\*.clr', 'N' )
  38. count = 1
  39. accounts.0 = 0
  40. do while s <> ''
  41.     accounts.count = AcctDir||'\'||s
  42.     accounts.0 = count
  43.     count = count + 1
  44.     s = VRDir( , 'N' )
  45. end
  46. do i = 1 to accounts.0
  47.     call stream accounts.i, 'c', 'open'
  48.     call stream accounts.i, 'c', 'seek =1'
  49.     do forever
  50.         if( lines( accounts.i ) = 0 )then
  51.             leave
  52.         line = linein( accounts.i )
  53.         parse var line key '=' value
  54.         if key = 'Account' then
  55.             account.i = value
  56.         if key = 'Type' then do
  57.             AccountType.i = value
  58.             leave
  59.         end
  60.     end
  61.     call stream accounts.i, 'c', 'close'
  62.     drop line key value
  63. end
  64. Account.0 = accounts.0
  65. AccountType.0 = accounts.0
  66.  
  67. if( VRFileExists( MAC ) )then
  68.     call VRDeleteFile MAC
  69. call lineout MAC, '/**************************************************/'
  70. call lineout MAC, '/* Macro file for reading accounts into container */'
  71. call lineout MAC, '/* DO NOT MODIFY                                  */'
  72. call lineout MAC, '/**************************************************/'
  73. call lineout MAC, "if VRFileExists( '!.!!!' )then call VRDeleteFile '!.!!!'"
  74. call lineout MAC, "if( \VRFileExists( 'q2et.exe' ) )then call VRSet 'MenuUtilQIF', 'Enabled', 0"
  75. call lineout MAC, "if( \VRFileExists( 'etreport.exe' ) )then call VRSet 'MenuAccountsPrint', 'Enabled', 0"
  76. call lineout MAC, "if( \VRFileExists( 'etbudget.exe' ) )then call VRSet 'MenuAccountsBudget', 'Enabled', 0"
  77. call lineout MAC, "icon = ''"
  78. if accounts.0 = 0 then do
  79.     buttons.0 = 3
  80.     buttons.1 = "~Create account..."
  81.     buttons.2 = "~Select directory..."
  82.     buttons.3 = "~Cancel"
  83.     msg.0 = 5
  84.     msg.1 = "Unable to locate account files in directory:  "AcctDir"\."
  85.     msg.2 = ""
  86.     msg.3 = "Possible reasons are:"
  87.     msg.4 = "1) Accounts have not yet been created."
  88.     msg.5 = "2) Accounts reside in a different directory."
  89.     id = VRMessageStem( "", "msg.", "Accounts Not Found", "Information", "buttons.", 1, 3 )
  90.     drop buttons. msg.
  91.     if id = 1 then
  92.         call VRMethod 'Application', 'PostQueue', 0, 1, 'call MenuAccountsNew_Click'
  93.     if id = 2 then
  94.         call VRMethod 'Application', 'PostQueue', 0, 1, 'call MenuAccountsDir_Click'
  95.     drop id
  96.     call stream MAC, 'c', 'close'
  97.     exit
  98. end
  99. if accounts.0 <> 0 then do i = 1 to accounts.0
  100.     call lineout MAC, "call lineout '!.!!!', '"account.i"'"
  101.     call lineout MAC, "call lineout '!.!!!', '"accounts.i"'"
  102. end
  103. call lineout MAC, "call stream '!.!!!', 'c', 'close'"
  104. if accounts.0 <> 0 then do i = 1 to accounts.0
  105.     call lineout MAC, "recHandle = VRMethod( 'CNAccounts', 'AddRecord', , , '"account.i"' )"
  106.     call lineout MAC, "if recHandle <> '' then do; call VRMethod 'CNAccounts', 'SetRecordAttr', recHandle, 'Caption', '"account.i"', 'FileName', '"accounts.i"'; call VRMethod 'CNAccounts', 'SetFieldData', recHandle, field.!Type, '"AccountType.i"'; end"
  107. end
  108. call lineout MAC, "call GetIcon"
  109. call stream MAC, 'c', 'close'
  110. drop MAC accounts. account. accounttype. s i AcctDir
  111. exit
  112.  
  113.